home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Wayzata's Best of Shareware PC/Windows 1
/
Wayzata's Best of Shareware for PC-Windows - Release 1 - Wayzata Technology (1993).iso
/
mac
/
DOS
/
PROGRAMG
/
FORTHCMP
/
READ.ME
< prev
next >
Wrap
Text File
|
1992-03-30
|
12KB
|
281 lines
What is ForthCMP?
ForthCMP is the Forth language compiler for computers running MS-DOS.
Features of ForthCMP:
∙ Compiles Forth into machine code -- not interpreted.
∙ ForthCMP is written in Forth so that Forth code can be executed
during compilation, as is customary in Forth applications.
∙ Very fast -- ForthCMP compiles Forth code into an executable file
in a single pass.
∙ Generated code is extremely compact. Over 100 Forth "primitives"
are compiled in-line. ForthCMP performs constant expression
folding, strength reduction, register optimization, DO...LOOP
optimization, tail recursion, and various "peephole"
optimizations.
∙ Built-in assembler.
∙ Libraries are in source format.
∙ ForthCMP supports many memory models, none big, but several not
often found in compilers:
° Single segment COM file, fixed at 64k bytes
° As above, but minimized segment size for TSRs
° Separate code and data segment EXE file
° Device driver SYS format
° Romable program, uninitialized ram
° Romable program, data ram initialized from rom image
° Any of the above can have a separate stack segment for
return and parameter stacks
∙ Functions exist for allocating memory in additional segments, or
allocating arrays on the stack, to handle programs with large
data memory requirements.
∙ Library support:
° The 83 Forth standard, except for functions that do not make
sense in a compiled environment.
° Many additional words that are non-standard but widely
accepted, such as SKIP SCAN NIP and TUCK.
° Direct Display Writing library for fast display of text in
color, and positioned on screen. For IBM-PC compatibles.
° Multitasker with message passing facility and timed sleeps.
° Library to support writing "Filter" programs.
° MS-DOS file interface, compatible with LMI Forths.
° String support, compatible with LMI Forths.
° Forth Vendor standard software floating point (for customers
of LMI Forth).
The History of ForthCMP
ForthCMP started as a project to selectively compile colon definitions
as code words in figForth back in 1982. I bundled this Native Code
Compiler with a Z-80 (tm Zilog) fig Forth I sold for embedded system
use at that time. Ray Duncan of Laboratory Microsystems was interested
in this product, and I ported it to LMI's Z-80 Forth for sale with his
Forth environment.
The Native Code Compiler was translated to the 8088 processor, and
more recently to the 80386. It still comes bundled with LMI's Forth
products.
In 1984 I became interested in the idea of a Forth compiler that would
compile entire applications into machine code rather than selected
colon definitions. Such a compiler would be capable of many additional
optimizations not available in a mixed system. Thus CFORTH, as it was
called, was born. The original version was for the Z-80, but a
Microsoft MS-DOS version was soon to follow. Laboratory Microsystems
sold CFORTH until roughly 1987 when it was removed from their catalog.
My feeling was that CFORTH simply wasn't understood, and that the wide
distribution of the reincarnated version, ForthCMP will have greater
acceptance.
I renamed the compiler to avoid confusion with C-Forth (Forth in C)
that has been available for the past few years.
ForthCMP does have a few changes from the CFORTH predecessor. Unlike
other compilers which seem to make application size grow with each new
release, ForthCMP programs take less memory than they did when
compiled with CFORTH. The startup code has been enhanced, and I've
added new optimizations for several common situations. I also made
changes to make ForthCMP run in Microsoft Windows, and under DOS 5.0.
I improved the way romable applications can be built, and added a new
memory model to allow creation of DOS device drivers (SYS files). In
total, I have devoted over 100 hours of effort into improving
ForthCMP.
When CFORTH was sold, it ran faster than C compilers, and created
executables that were far smaller and faster. C compiler technology is
catching up; for instance the most recent versions of Microsoft and
Borland Cs allow passing arguments in registers, something that CFORTH
did back in 1984. But the C compilers have gotten much bigger and
slower over the years. ForthCMP still runs fine on a machine without a
hard disk. The compiler is only about 32k bytes long.
ForthCMP is "Shareware"
Forth is one of very few programming languages whose adherents tend to
feel that their compilers should be free. Unfortunately this has
doomed the language to a second rate status because nobody can make a
living selling Forth tools. I have realized that myself, having only
made enough money to pay for my computer systems over the years with
Forth.
There does seem to be quite a market for Forth books and manuals, as
all of this free software does seem to be rather poorly documented. I
am taking a novel approach in distributing ForthCMP. This archive file
contains all ForthCMP libraries (with one exception -- software
floating point) and all demo programs. But there is no documentation!
Also some files used for compatibility with LMI Forths have been
omitted.
To evaluate ForthCMP, place all the files in one directory and compile
some of the sample programs. The program DEMO.4TH is well enough
documented to give you a good start in writing your own ForthCMP
programs. Use DEBUG to examine the generated code -- you will find it
is quite good, often combining sequences of Forth primitives into a
single machine instruction.
If you like what you see, you can register your copy of ForthCMP and
obtain the users' manual (113 page, 28,500 word, laser printed) and a
disk with the latest version for $50.00. Send a personal check or
money order; I do not accept COD orders or credit cards, but I do ship
quickly without waiting for checks to clear. Customers outside the US
please remit in US funds $60.00 to cover the additional shipping
costs. Please specify floppy disk size and capacity.
I'm a hungry guy, so please register within 30 days. I won't be
pleased if you distribute an application using ForthCMP without first
registering. (It's also a copyright violation).
If you own a copy of any Laboratory Microsystems (LMI) Forth with
software floating point, send a photocopy of the first page of the
software floating point section of the manual with your order and
receive a disk containing software floating point for ForthCMP at no
additional charge.
Mail your order to:
Tom Almy
17830 SW Shasta Trail
Tualatin, OR 97062
ForthCMP's Future
I've had several ideas in the wings these past few years. If ForthCMP
is a success this year (1992), I will probably produce a new version.
Most of these concepts are tried; it is just a matter of tying them
together:
∙ Change in underlying Forth, and better use of memory, will give a
20% or better speed improvement while increasing the compiler
capacity.
∙ A simple macro facility
∙ Intrinsic dynamically allocated arrays
∙ 80x87 floating point support (this is a very fast and accurate
implementation).
∙ Improved optimization of return stack and registers
Distributed Files
Here is a brief description of the distribution files:
The heart of the matter:
4c.ico Icon for Microsoft Windows 3.x
4c.pif PIF file for Microsoft Windows 3.x
readme.doc This file
4c.com The compiler executable
Library files:
display1.4th Fast direct display output
display2.4th Second part of above
dos1.4th File I/O
dos2.4th Second part of above
dosgo.scr Initialization code, COM format
exec.4th EXEC function (DOS shell)
exego.scr Initialization code, EXE format
farmem1.4th "Far" memory allocation
farmem2.4th Second part of above
filter.4th Used to write "filter" type programs
forthlib.scr Basic library
ints.4th Used for writing interrupt handlers
multi.4th Multitasker
multid.4th Multitasker with direct display output
romgo.4th Example initialization code, ROM format
strings1.4th String functions
strings2.4th Second part of above
vars.4th 83 Standard variables
Demo and utility programs:
bytebnch.4th The old Byte Magazine sieve benchmark
copies.4th Merges screen files
defining.4th Examples of defining word usage
demo.4th Generic Demo -- read this first
driver.4th Example device driver
enscreen.4th Convert ASCII to screen file
ffind.4th Search for string in screen files
find.4th Search for string in ASCII files
hanoi.4th Tower of Hanoi Puzzle
hanoimt.4th Multitasking Tower of Hanoi (read before
compiling)
iagebnch.4th Interface Age Magazine benchmark
index.4th List first line of each screen in screen file
interupt.4th Example of interrupt handling
kbdr.4th Example TSR to exchange CapsLock and Ctrl keys
life.4th Conway's Life
list.4th List a screen file
queens.4th Solves Eight Queens puzzle
scrdif.4th Compares two screen files
tail.4th List first/last n lines/characters of a file
tr.4th Translate characters in a file
uniq.4th Find/delete duplicate lines in a file
unload.4th Convert COM to HEX format
unscreen.4th Convert screen file to ASCII file
wc.4th Count words/lines/pages in a file
Limited Warranty
When registered, Thomas Almy warrants the floppy disk and manual to be
free of defects in material and workmanship for 90 days from date of
shipment.
Thomas Almy makes no warranty, either expressed or implied, with
respect to the use of ForthCMP or any of the utility and demo programs
supplied. You, the user, are expected to evaluate the software for
appropriateness before registration. Thomas Almy is under no
circumstances liable for consequential damages or related expenses. In
any case liability is limited to the registration cost of ForthCMP.